/**
 * <copyright>
 * </copyright>
 *

 */
package br.ufpe.cin.plp.eseml.impl;

import br.ufpe.cin.plp.eseml.EsemlPackage;
import br.ufpe.cin.plp.eseml.ExperimentDesign;
import br.ufpe.cin.plp.eseml.ExperimentalObjects;
import br.ufpe.cin.plp.eseml.ExperimentalSubjects;
import br.ufpe.cin.plp.eseml.Hypotheses;
import br.ufpe.cin.plp.eseml.Variables;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Experiment Design</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.ExperimentDesignImpl#getVariables <em>Variables</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.ExperimentDesignImpl#getHypotheses <em>Hypotheses</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.ExperimentDesignImpl#getExperimentalObjects <em>Experimental Objects</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.ExperimentDesignImpl#getExperimentalSubjects <em>Experimental Subjects</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ExperimentDesignImpl extends MinimalEObjectImpl.Container implements ExperimentDesign
{
  /**
   * The cached value of the '{@link #getVariables() <em>Variables</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVariables()
   * @generated
   * @ordered
   */
  protected Variables variables;

  /**
   * The cached value of the '{@link #getHypotheses() <em>Hypotheses</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getHypotheses()
   * @generated
   * @ordered
   */
  protected Hypotheses hypotheses;

  /**
   * The cached value of the '{@link #getExperimentalObjects() <em>Experimental Objects</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExperimentalObjects()
   * @generated
   * @ordered
   */
  protected ExperimentalObjects experimentalObjects;

  /**
   * The cached value of the '{@link #getExperimentalSubjects() <em>Experimental Subjects</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getExperimentalSubjects()
   * @generated
   * @ordered
   */
  protected ExperimentalSubjects experimentalSubjects;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ExperimentDesignImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EsemlPackage.Literals.EXPERIMENT_DESIGN;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Variables getVariables()
  {
    return variables;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetVariables(Variables newVariables, NotificationChain msgs)
  {
    Variables oldVariables = variables;
    variables = newVariables;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__VARIABLES, oldVariables, newVariables);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setVariables(Variables newVariables)
  {
    if (newVariables != variables)
    {
      NotificationChain msgs = null;
      if (variables != null)
        msgs = ((InternalEObject)variables).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__VARIABLES, null, msgs);
      if (newVariables != null)
        msgs = ((InternalEObject)newVariables).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__VARIABLES, null, msgs);
      msgs = basicSetVariables(newVariables, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__VARIABLES, newVariables, newVariables));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Hypotheses getHypotheses()
  {
    return hypotheses;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetHypotheses(Hypotheses newHypotheses, NotificationChain msgs)
  {
    Hypotheses oldHypotheses = hypotheses;
    hypotheses = newHypotheses;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES, oldHypotheses, newHypotheses);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHypotheses(Hypotheses newHypotheses)
  {
    if (newHypotheses != hypotheses)
    {
      NotificationChain msgs = null;
      if (hypotheses != null)
        msgs = ((InternalEObject)hypotheses).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES, null, msgs);
      if (newHypotheses != null)
        msgs = ((InternalEObject)newHypotheses).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES, null, msgs);
      msgs = basicSetHypotheses(newHypotheses, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES, newHypotheses, newHypotheses));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExperimentalObjects getExperimentalObjects()
  {
    return experimentalObjects;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetExperimentalObjects(ExperimentalObjects newExperimentalObjects, NotificationChain msgs)
  {
    ExperimentalObjects oldExperimentalObjects = experimentalObjects;
    experimentalObjects = newExperimentalObjects;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS, oldExperimentalObjects, newExperimentalObjects);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setExperimentalObjects(ExperimentalObjects newExperimentalObjects)
  {
    if (newExperimentalObjects != experimentalObjects)
    {
      NotificationChain msgs = null;
      if (experimentalObjects != null)
        msgs = ((InternalEObject)experimentalObjects).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS, null, msgs);
      if (newExperimentalObjects != null)
        msgs = ((InternalEObject)newExperimentalObjects).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS, null, msgs);
      msgs = basicSetExperimentalObjects(newExperimentalObjects, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS, newExperimentalObjects, newExperimentalObjects));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExperimentalSubjects getExperimentalSubjects()
  {
    return experimentalSubjects;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetExperimentalSubjects(ExperimentalSubjects newExperimentalSubjects, NotificationChain msgs)
  {
    ExperimentalSubjects oldExperimentalSubjects = experimentalSubjects;
    experimentalSubjects = newExperimentalSubjects;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS, oldExperimentalSubjects, newExperimentalSubjects);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setExperimentalSubjects(ExperimentalSubjects newExperimentalSubjects)
  {
    if (newExperimentalSubjects != experimentalSubjects)
    {
      NotificationChain msgs = null;
      if (experimentalSubjects != null)
        msgs = ((InternalEObject)experimentalSubjects).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS, null, msgs);
      if (newExperimentalSubjects != null)
        msgs = ((InternalEObject)newExperimentalSubjects).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS, null, msgs);
      msgs = basicSetExperimentalSubjects(newExperimentalSubjects, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS, newExperimentalSubjects, newExperimentalSubjects));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case EsemlPackage.EXPERIMENT_DESIGN__VARIABLES:
        return basicSetVariables(null, msgs);
      case EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES:
        return basicSetHypotheses(null, msgs);
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS:
        return basicSetExperimentalObjects(null, msgs);
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS:
        return basicSetExperimentalSubjects(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EsemlPackage.EXPERIMENT_DESIGN__VARIABLES:
        return getVariables();
      case EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES:
        return getHypotheses();
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS:
        return getExperimentalObjects();
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS:
        return getExperimentalSubjects();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EsemlPackage.EXPERIMENT_DESIGN__VARIABLES:
        setVariables((Variables)newValue);
        return;
      case EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES:
        setHypotheses((Hypotheses)newValue);
        return;
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS:
        setExperimentalObjects((ExperimentalObjects)newValue);
        return;
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS:
        setExperimentalSubjects((ExperimentalSubjects)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.EXPERIMENT_DESIGN__VARIABLES:
        setVariables((Variables)null);
        return;
      case EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES:
        setHypotheses((Hypotheses)null);
        return;
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS:
        setExperimentalObjects((ExperimentalObjects)null);
        return;
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS:
        setExperimentalSubjects((ExperimentalSubjects)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.EXPERIMENT_DESIGN__VARIABLES:
        return variables != null;
      case EsemlPackage.EXPERIMENT_DESIGN__HYPOTHESES:
        return hypotheses != null;
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_OBJECTS:
        return experimentalObjects != null;
      case EsemlPackage.EXPERIMENT_DESIGN__EXPERIMENTAL_SUBJECTS:
        return experimentalSubjects != null;
    }
    return super.eIsSet(featureID);
  }

} //ExperimentDesignImpl
